package com.cyj.service.impl;

import com.cyj.dao.AnimeTypeDao;
import com.cyj.entity.Anime;
import com.cyj.entity.AnimeType;
import com.cyj.service.AnimeTypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AnimeTypeServiceImpl implements AnimeTypeService {

    @Autowired
    private AnimeTypeDao animeTypeDao;

    @Override
    public AnimeType selectAnimeType(Map map) {
        return animeTypeDao.selectAnimeType(map);
    }

    @Override
    public List<AnimeType> allAnimeTypeList(Map map) {
        return animeTypeDao.selectAnimeTypeList(map);
    }

    @Override
    public PageInfo<AnimeType> selectAnimeTypeList(Map map, int pn, int pageSize) {
        PageHelper.startPage(pn,pageSize);

        List<AnimeType> list = animeTypeDao.selectAnimeTypeList(map);

        PageInfo<AnimeType> pageInfo = new PageInfo<AnimeType>(list,5);
        return pageInfo;
    }

    @Override
    public Integer addAnimeType(AnimeType animeType) {
        return animeTypeDao.addAnimeType(animeType);
    }

    @Override
    public Integer updateAnimeType(AnimeType animeType) {
        return animeTypeDao.updateAnimeType(animeType);
    }

    @Override
    public Integer deleteAnimeType(Integer typeId) {
        return animeTypeDao.deleteAnimeType(typeId);
    }
}
